Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surefire test filtering support #1

Draft
wants to merge 3 commits into
base: feature/issue-641-tooling-tests
Choose a base branch
from

Conversation

crizzis
Copy link
Owner

@crizzis crizzis commented Jun 10, 2022

Signed-off-by: Krzysztof Sierszeń krzysztof.sierszen@digitalnewagency.com

@@ -46,23 +51,19 @@ test {

shadowJar {
exclude 'META-INF/maven/**'

dependencies {
Copy link
Owner Author

@crizzis crizzis Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certain dependencies (e.g. junitPlatformLaungher) are needed with their original (unshadowed) package names (see why here and here)

The changes made to the shadowJar config, as well as disabling both checkExportedPackage and checkArtifact, was the only way I managed to get it work. Leaving the current config resulted in a bunch of ClassNotFoundExceptions in tests, because the classes from junitPlatformLauncher, surefireApi etc. would, unsurprisingly, not be found on the runtime test classpath.

Please advise on how this requirement should properly be handled. If the packages absolutely must be shadowed, I can introduce a proxy at runtime, but that just adds unnecessary complexity IMHO.

PostDiscoveryFilter postDiscoveryFilter = findPostDiscoveryFilter(request);
PostDiscoveryFilter replacement = initialize(postDiscoveryFilter);
if (replacement != postDiscoveryFilter) {
replaceFilter(request, postDiscoveryFilter, replacement);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if statement is not yet used (will be needed for Gradle filtering)

try {
if (SurefireTestNameFilter.appliesTo(discoveryRequest)) {
return new SurefireTestNameFilter(discoveryRequest);
}
Copy link
Owner Author

@crizzis crizzis Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another else if branch could essentially be added here if we also want to introduce a filter based on custom ArchUnit properties, like the ticket suggests

@crizzis crizzis force-pushed the feature/issue-641-surefire branch from d4d6021 to d1cea3d Compare June 23, 2022 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant